package org.neuedu.ssmp.crm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.neuedu.ssmp.crm.entity.CustomerLost;
import org.neuedu.ssmp.crm.entity.Orders;
import org.neuedu.ssmp.crm.mapper.CustomerLostMapper;
import org.neuedu.ssmp.crm.mapper.OrdersMapper;
import org.neuedu.ssmp.crm.service.ICustomerLostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author MoonHolder
 * @since 2019-12-09
 */
@Service
public class CustomerLostServiceImpl extends ServiceImpl<CustomerLostMapper, CustomerLost> implements ICustomerLostService {

    @Autowired
    private CustomerLostMapper customerLostMapper;

    @Override
    public List<CustomerLost> queryAll() {
//        return customerLostMapper.queryAll();
        return customerLostMapper.queryAll(new QueryWrapper<CustomerLost>());
    }

    @Override
    public List<CustomerLost> vagueQusery(String name, String username, String state) {
        if (state.equals("查询全部")){
            return customerLostMapper.queryAll(new QueryWrapper<CustomerLost>());
        }
        return customerLostMapper.vagueQusery(name,username,state);
    }

    @Override
    public List<CustomerLost> queryAlls(Integer customerId) {
        return customerLostMapper.queryAlls(customerId);
    }

    @Override
    public int update(int id,String content,String addMeasures,String lostCause,String state,LocalDate lostDay) {
//        lostDay = LocalDate.now();
        return customerLostMapper.update(id, content, addMeasures, lostCause,state,lostDay);
    }

    @Override
    public int inserts(int customerId, LocalDate orderTime) {
        return customerLostMapper.inserts(customerId,orderTime);
    }

    @Override
    public List<CustomerLost> myQuery() {
        return customerLostMapper.myQuery();
    }

    @Override
    public List<Integer> cId() {
        return customerLostMapper.cId();
    }


}
